<template>
  <div class="tabbar-title" @click="itemClick">
    <span :class="{ active: isActive }"><slot name="iocn"></slot></span>
    <div :class="{ active: isActive }"><slot name="text"></slot></div>
  </div>
</template>

<script>
export default {
  props: {
    path: String,
  },
  computed: {
    isActive() {
      return this.$route.path.indexOf(this.path) !== -1;
    },
  },
  methods: {
    itemClick() {
      this.$router.push(this.path);
    },
  },
};
</script>

<style lang="less" scoped>
.active {
  color: red;
}
</style>
